/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package travelexperts;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "customers", catalog = "travelexperts", schema = "")
@NamedQueries({
    @NamedQuery(name = "Customers.findAll", query = "SELECT c FROM Customers c"),
    @NamedQuery(name = "Customers.findByCustomerId", query = "SELECT c FROM Customers c WHERE c.customerId = :customerId"),
    @NamedQuery(name = "Customers.findByCustFirstName", query = "SELECT c FROM Customers c WHERE c.custFirstName = :custFirstName"),
    @NamedQuery(name = "Customers.findByCustLastName", query = "SELECT c FROM Customers c WHERE c.custLastName = :custLastName"),
    @NamedQuery(name = "Customers.findByCustAddress", query = "SELECT c FROM Customers c WHERE c.custAddress = :custAddress"),
    @NamedQuery(name = "Customers.findByCustCity", query = "SELECT c FROM Customers c WHERE c.custCity = :custCity"),
    @NamedQuery(name = "Customers.findByCustProv", query = "SELECT c FROM Customers c WHERE c.custProv = :custProv"),
    @NamedQuery(name = "Customers.findByCustPostal", query = "SELECT c FROM Customers c WHERE c.custPostal = :custPostal"),
    @NamedQuery(name = "Customers.findByCustCountry", query = "SELECT c FROM Customers c WHERE c.custCountry = :custCountry"),
    @NamedQuery(name = "Customers.findByCustHomePhone", query = "SELECT c FROM Customers c WHERE c.custHomePhone = :custHomePhone"),
    @NamedQuery(name = "Customers.findByCustBusPhone", query = "SELECT c FROM Customers c WHERE c.custBusPhone = :custBusPhone"),
    @NamedQuery(name = "Customers.findByCustEmail", query = "SELECT c FROM Customers c WHERE c.custEmail = :custEmail"),
    @NamedQuery(name = "Customers.findByAgentId", query = "SELECT c FROM Customers c WHERE c.agentId = :agentId")})
public class Customers implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "CustomerId")
    private Integer customerId;
    @Basic(optional = false)
    @Column(name = "CustFirstName")
    private String custFirstName;
    @Basic(optional = false)
    @Column(name = "CustLastName")
    private String custLastName;
    @Basic(optional = false)
    @Column(name = "CustAddress")
    private String custAddress;
    @Basic(optional = false)
    @Column(name = "CustCity")
    private String custCity;
    @Basic(optional = false)
    @Column(name = "CustProv")
    private String custProv;
    @Basic(optional = false)
    @Column(name = "CustPostal")
    private String custPostal;
    @Column(name = "CustCountry")
    private String custCountry;
    @Column(name = "CustHomePhone")
    private String custHomePhone;
    @Basic(optional = false)
    @Column(name = "CustBusPhone")
    private String custBusPhone;
    @Basic(optional = false)
    @Column(name = "CustEmail")
    private String custEmail;
    @Column(name = "AgentId")
    private Integer agentId;

    public Customers() {
    }

    public Customers(Integer customerId) {
        this.customerId = customerId;
    }

    public Customers(Integer customerId, String custFirstName, String custLastName, String custAddress, String custCity, String custProv, String custPostal, String custBusPhone, String custEmail) {
        this.customerId = customerId;
        this.custFirstName = custFirstName;
        this.custLastName = custLastName;
        this.custAddress = custAddress;
        this.custCity = custCity;
        this.custProv = custProv;
        this.custPostal = custPostal;
        this.custBusPhone = custBusPhone;
        this.custEmail = custEmail;
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Integer customerId) {
        Integer oldCustomerId = this.customerId;
        this.customerId = customerId;
        changeSupport.firePropertyChange("customerId", oldCustomerId, customerId);
    }

    public String getCustFirstName() {
        return custFirstName;
    }

    public void setCustFirstName(String custFirstName) {
        String oldCustFirstName = this.custFirstName;
        this.custFirstName = custFirstName;
        changeSupport.firePropertyChange("custFirstName", oldCustFirstName, custFirstName);
    }

    public String getCustLastName() {
        return custLastName;
    }

    public void setCustLastName(String custLastName) {
        String oldCustLastName = this.custLastName;
        this.custLastName = custLastName;
        changeSupport.firePropertyChange("custLastName", oldCustLastName, custLastName);
    }

    public String getCustAddress() {
        return custAddress;
    }

    public void setCustAddress(String custAddress) {
        String oldCustAddress = this.custAddress;
        this.custAddress = custAddress;
        changeSupport.firePropertyChange("custAddress", oldCustAddress, custAddress);
    }

    public String getCustCity() {
        return custCity;
    }

    public void setCustCity(String custCity) {
        String oldCustCity = this.custCity;
        this.custCity = custCity;
        changeSupport.firePropertyChange("custCity", oldCustCity, custCity);
    }

    public String getCustProv() {
        return custProv;
    }

    public void setCustProv(String custProv) {
        String oldCustProv = this.custProv;
        this.custProv = custProv;
        changeSupport.firePropertyChange("custProv", oldCustProv, custProv);
    }

    public String getCustPostal() {
        return custPostal;
    }

    public void setCustPostal(String custPostal) {
        String oldCustPostal = this.custPostal;
        this.custPostal = custPostal;
        changeSupport.firePropertyChange("custPostal", oldCustPostal, custPostal);
    }

    public String getCustCountry() {
        return custCountry;
    }

    public void setCustCountry(String custCountry) {
        String oldCustCountry = this.custCountry;
        this.custCountry = custCountry;
        changeSupport.firePropertyChange("custCountry", oldCustCountry, custCountry);
    }

    public String getCustHomePhone() {
        return custHomePhone;
    }

    public void setCustHomePhone(String custHomePhone) {
        String oldCustHomePhone = this.custHomePhone;
        this.custHomePhone = custHomePhone;
        changeSupport.firePropertyChange("custHomePhone", oldCustHomePhone, custHomePhone);
    }

    public String getCustBusPhone() {
        return custBusPhone;
    }

    public void setCustBusPhone(String custBusPhone) {
        String oldCustBusPhone = this.custBusPhone;
        this.custBusPhone = custBusPhone;
        changeSupport.firePropertyChange("custBusPhone", oldCustBusPhone, custBusPhone);
    }

    public String getCustEmail() {
        return custEmail;
    }

    public void setCustEmail(String custEmail) {
        String oldCustEmail = this.custEmail;
        this.custEmail = custEmail;
        changeSupport.firePropertyChange("custEmail", oldCustEmail, custEmail);
    }

    public Integer getAgentId() {
        return agentId;
    }

    public void setAgentId(Integer agentId) {
        Integer oldAgentId = this.agentId;
        this.agentId = agentId;
        changeSupport.firePropertyChange("agentId", oldAgentId, agentId);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (customerId != null ? customerId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customers)) {
            return false;
        }
        Customers other = (Customers) object;
        if ((this.customerId == null && other.customerId != null) || (this.customerId != null && !this.customerId.equals(other.customerId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return " " + customerId + " "+custFirstName+" "+custLastName;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
